// single-spa-config.js
import * as singleSpa from 'single-spa';
import './style.css';
import { application } from './application';
import { VueElementConstructor } from 'vue';

const { registerApplication, start } = singleSpa;

// Simple usage
application.forEach(async e => {
  if (e) {
    // 没有activeWhen => 默认加载
    if (!e?.activeWhen) {
      const { mount, bootstrap, unmount } = e.app;
      await bootstrap();
      const vm: VueElement = await mount();
      debugger;
    } else {
      registerApplication({
        name: e.name,
        app: e.app,
        activeWhen: e.activeWhen,
        customProps: {
          // domElement:
        }
      });
    }
  }
});
start();
